﻿@model IEnumerable<BindTryParseMVC.Models.Contact>

@{
    ViewData["Title"] = "Index";
}

<h1>Index</h1>

<p>
    <a asp-area="" asp-controller="Contacts" asp-action="Create">CreateNew</a>
</p>

<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model=>model.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Email)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.PhoneNumber)
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach(var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(mbox=>item.Name)
                </td>
                <td>
                    @Html.DisplayFor(mbox => item.Email)
                </td>
                <td>
                    @Html.DisplayFor(mbox => item.PhoneNumber)
                </td>
                <td>
                    <a asp-action="Edit" asp-route-id="@item.Id">Edit</a>
                    <a asp-action="Details" asp-route-id="@item.Id">Details</a>
                    <a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
                </td>
            </tr>
        }
    </tbody>
</table>